﻿using System;
using UnityEngine;

// Token: 0x02000639 RID: 1593
public abstract class MathfEx
{
	// Token: 0x06002610 RID: 9744 RVA: 0x00146718 File Offset: 0x00144918
	public static float LerpAccel(float from, float to, float t)
	{
		return Mathf.Lerp(from, to, Mathf.Sqrt(t));
	}

	// Token: 0x06002611 RID: 9745 RVA: 0x00146728 File Offset: 0x00144928
	public static bool RangeEqualOn(int min, int n, int max)
	{
		return min <= n && max >= n;
	}

	// Token: 0x06002612 RID: 9746 RVA: 0x00146740 File Offset: 0x00144940
	public static bool RangeEqualOn(float min, float n, float max)
	{
		return min <= n && max >= n;
	}

	// Token: 0x06002613 RID: 9747 RVA: 0x00146758 File Offset: 0x00144958
	public static bool RangeEqualOff(int min, int n, int max)
	{
		return min < n && max > n;
	}

	// Token: 0x06002614 RID: 9748 RVA: 0x00146770 File Offset: 0x00144970
	public static bool RangeEqualOff(float min, float n, float max)
	{
		return min < n && max > n;
	}

	// Token: 0x06002615 RID: 9749 RVA: 0x00146788 File Offset: 0x00144988
	public static float LerpBrake(float from, float to, float t)
	{
		return Mathf.Lerp(from, to, t * (2f - t));
	}

	// Token: 0x06002616 RID: 9750 RVA: 0x0014679C File Offset: 0x0014499C
	public static float NewtonMethod(global::MathfEx.Func func, global::MathfEx.Func derive, float initX, int maxLoop)
	{
		float num = initX;
		for (int i = 0; i < maxLoop; i++)
		{
			float num2 = func(num);
			if (num2 < 1E-05f && num2 > -1E-05f)
			{
				break;
			}
			num -= num2 / derive(num);
		}
		return num;
	}

	// Token: 0x06002617 RID: 9751 RVA: 0x001467F0 File Offset: 0x001449F0
	public static void LoopValue(ref int value, int start, int end)
	{
		if (value > end)
		{
			value = start;
		}
		else if (value < start)
		{
			value = end;
		}
	}

	// Token: 0x06002618 RID: 9752 RVA: 0x00146810 File Offset: 0x00144A10
	public static Rect AspectRect(float baseH = 1280f, float rate = 720f)
	{
		float y = ((float)Screen.height - (float)Screen.width / baseH * rate) * 0.5f / (float)Screen.height;
		float height = rate * (float)Screen.width / baseH / (float)Screen.height;
		return new Rect(0f, y, 1f, height);
	}

	// Token: 0x06002619 RID: 9753 RVA: 0x00146860 File Offset: 0x00144A60
	public static long Min(long _a, long _b)
	{
		return (_a <= _b) ? _a : _b;
	}

	// Token: 0x0600261A RID: 9754 RVA: 0x00146870 File Offset: 0x00144A70
	public static long Max(long _a, long _b)
	{
		return (_a <= _b) ? _b : _a;
	}

	// Token: 0x0600261B RID: 9755 RVA: 0x00146880 File Offset: 0x00144A80
	public static long Clamp(long _value, long _min, long _max)
	{
		return global::MathfEx.Min(global::MathfEx.Max(_value, _min), _max);
	}

	// Token: 0x0600261C RID: 9756 RVA: 0x00146890 File Offset: 0x00144A90
	public static float ToRadian(float degree)
	{
		return degree * 0.0174532924f;
	}

	// Token: 0x0600261D RID: 9757 RVA: 0x0014689C File Offset: 0x00144A9C
	public static float ToDegree(float radian)
	{
		return radian * 57.29578f;
	}

	// Token: 0x0200063A RID: 1594
	// (Invoke) Token: 0x0600261F RID: 9759
	public delegate float Func(float x);
}
